
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>悠然时光智慧居家养老服务平台</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" type="text/css" href="http://xcx.yrtime.cn:9988/yrsg/common/layui/css/layui.css?_t=1585703091045"/>
    <link rel="stylesheet" type="text/css" href="http://xcx.yrtime.cn:9988/yrsg/common/spop/spop.min.css?_t=1585703091045"/>
    <link rel="stylesheet" href="http://xcx.yrtime.cn:9988/yrsg/adminui/ui/global/bootstrap/css/bootstrap.min.css?_t=1585703091045">
    <link rel="stylesheet" href="http://xcx.yrtime.cn:9988/yrsg/adminui/ui/global/font-awesome/css/font-awesome.css?_t=1585703091045" />
    <!-- Theme style -->
    <link rel="stylesheet" href="http://xcx.yrtime.cn:9988/yrsg/adminui/adminlte/dist/css/AdminLTE.css?_t=1585703091045">
    <link rel="stylesheet" href="http://xcx.yrtime.cn:9988/yrsg/adminui/adminlte/dist/css/skins/_all-skins.css?_t=1585703091045">
    <link rel="stylesheet" type="text/css" href="http://xcx.yrtime.cn:9988/yrsg/common/layui/css/modules/layim/layim.css?_t=1585703091045"/>
    <link rel="stylesheet" href="http://xcx.yrtime.cn:9988/yrsg/adminui/min/css/supershopui.common.min.css?_t=1585703091045"/>
    <style type="text/css">
        html {overflow: hidden;}
        .layui-edge{display:block;}
    </style>
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini fixed">
<div class="wrapper">
    <!-- Main Header -->
    <header class="main-header" id="main-header">
        <!-- Logo -->
        <a href="" class="logo">
            <!-- mini logo for sidebar mini 50x50 pixels -->
            <span class="logo-mini"><b>悠然</b>时光</span>
            <!-- logo for regular state and mobile devices -->
            <span class="logo-lg"><b>悠然时光</b>服务平台</span>
        </a>

        <!-- Header Navbar -->
        <nav class="navbar navbar-static-top" role="navigation">
            <!-- Sidebar toggle button-->
            <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
                <span class="sr-only">切换导航</span>
            </a>
            <!-- Navbar Right Menu -->
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <!-- Notifications Menu -->
                    <!-- <li class="dropdown notifications-menu">
                        Menu toggle button
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <i class="fa fa-bell-o"></i>
                            <span class="label label-warning">0</span>
                        </a>
                        <ul class="dropdown-menu">
                            <li class="header">你有0条消息</li>
                            <li>
                                <ul class="menu">
                                    <li><a href="#"><i class="fa fa-users text-aqua"></i> 新用户注册!</a></li>
                                </ul>
                            </li>
                            <li class="footer"><a href="#">查看所有</a></li>
                        </ul>
                    </li> -->
                    <!-- User Account Menu -->
                    <li class="dropdown user user-menu">
                        <!-- Menu Toggle Button -->
                        <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">
                            <!-- The user image in the navbar-->
                            <img src="http://xcx.yrtime.cn:9988/yrsg/images/default.jpg" class="user-image" alt="User Image"/>
                            <!-- hidden-xs hides the username on small devices so only the image appears. -->
                            <span class="hidden-xs">TZHSWEET</span>
                        </a>
                        <ul class="dropdown-menu">
                            <!-- The user image in the menu -->
                            <li class="user-header">
                                <img src="http://xcx.yrtime.cn:9988/yrsg/images/default.jpg" class="img-circle" alt="User Image">
                                <p>
                                    <span>--</span>
                                </p>
                            </li>
                            <!-- Menu Body -->
                            <li class="user-body" style="display: none;">
                                <div class="row">
                                    <div class="col-xs-4 text-center">
                                        <a href="#">个人信息</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">设置</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">主题</a>
                                    </div>
                                </div>
                                <!-- /.row -->
                            </li>
                            <!-- Menu Footer-->
                            <li class="user-footer">
                                <div class="pull-left">
                                    <a href="javascript:void(0)" onclick="addTabs(({ id: 'user_center', title: '个人中心', close: true, url: 'http://xcx.yrtime.cn:9988/yrsg/view/user/user_center.htm' }))" class="btn btn-default btn-flat">个人中心</a>
                                </div>
                                <div class="pull-right">
                                    <a href="javascript:void(0)" reurl="http://xcx.yrtime.cn:9988/yrsg/loginOut.json" class="btn btn-default btn-flat login-out">退出</a>
                                </div>
                            </li>
                        </ul>
                    </li>
                    <!-- Control Sidebar Toggle Button -->
                    <li>
                        <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
                    </li>
                </ul>
            </div>
        </nav>
    </header>
    <!-- Left side column. contains the logo and sidebar -->
    <aside class="main-sidebar">
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
            <!-- Sidebar Menu -->
            <ul class="sidebar-menu"></ul>
            <!-- /.sidebar-menu -->
        </section>
        <!-- /.sidebar -->
    </aside>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper"  id="content-wrapper">
        <div class="content-tabs">
            <button class="roll-nav roll-left tabLeft" onclick="scrollTabLeft()">
                <i class="fa fa-backward"></i>
            </button>
            <nav class="page-tabs menuTabs tab-ui-menu" id="tab-menu">
                <div class="page-tabs-content" style="margin-left: 0px;">

                </div>
            </nav>
            <button class="roll-nav roll-right tabRight" onclick="scrollTabRight()">
                <i class="fa fa-forward" style="margin-left: 3px;"></i>
            </button>
            <div class="btn-group roll-nav roll-right">
                <button class="dropdown tabClose" data-toggle="dropdown">
                    页签操作<i class="fa fa-caret-down" style="padding-left: 3px;"></i>
                </button>
                <ul class="dropdown-menu dropdown-menu-right" style="min-width: 128px;">
                    <li><a class="tabReload" href="javascript:refreshTab();">刷新当前</a></li>
                    <li><a class="throwingScreen" href="javascript:throwingScreen();">投屏显示</a></li>
                    <li><a class="tabCloseCurrent" href="javascript:closeCurrentTab();">关闭当前</a></li>
                    <li><a class="tabCloseAll" href="javascript:closeOtherTabs(true);">全部关闭</a></li>
                    <li><a class="tabCloseOther" href="javascript:closeOtherTabs();">除此之外全部关闭</a></li>
                </ul>
            </div>
            <button class="roll-nav roll-right fullscreen" ><i class="fa fa-arrows-alt"></i></button>
        </div>
        <div class="content-iframe " style="background-color: #eaedef; ">
            <div class="tab-content " id="tab-content"></div>
        </div>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <!-- Main Footer -->
    <!-- <footer class="main-footer">
        <div class="pull-right hidden-xs">技术支持：安徽新华博信息技术股份有限公司</div>
        Copyright 2017 AHPSD All Rights Reserved ©安徽省公安厅版权所有     皖ICP备05015515号
    </footer> -->
    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
        <ul class="nav nav-tabs nav-justified control-sidebar-tabs"></ul>
        <div class="tab-content">
            <div class="tab-pane" id="control-sidebar-home-tab"></div>
        </div>
    </aside>
    <!-- /.control-sidebar -->
    <!-- Add the sidebar's background. This div must be placed immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
    <audio id="phoneAudio" src="http://xcx.yrtime.cn:9988/yrsg/files/phone.mp3" type="audio/mpeg"></audio>
    <a href="#" style="display: none" target="_blank"><span id="link-span">aaa</span></a>
</div>
<!-- ./wrapper -->
<!-- REQUIRED JS SCRIPTS -->
<!-- jQuery 2.2.3 -->
<script type="text/javascript" src="http://xcx.yrtime.cn:9988/yrsg/adminui/ui/global/jQuery/jquery.min.js?_t=1585703091045"></script>
<!-- Bootstrap 3.3.6 -->
<script type="text/javascript" src="http://xcx.yrtime.cn:9988/yrsg/adminui/ui/global/bootstrap/js/bootstrap.min.js?_t=1585703091045"></script>
<script type="text/javascript" src="http://xcx.yrtime.cn:9988/yrsg/adminui/min/js/supershopui.common.js?_t=1585703091045"></script>
<script type="text/javascript" src="http://xcx.yrtime.cn:9988/yrsg/common/layui/lay/dest/layui.all.js?_t=1585703091045"></script>
<script type="text/javascript" src="http://xcx.yrtime.cn:9988/yrsg/common/spop/spop.min.js?_t=1585703091045"></script>
<script type="text/javascript" src="http://xcx.yrtime.cn:9988/yrsg/js/reconnecting-websocket.js?_t=1585703091045"></script>
<script type="text/javascript" src="http://xcx.yrtime.cn:9988/yrsg/js/template-web.js?_t=1585703091045"></script>
<script type="text/javascript" src="http://xcx.yrtime.cn:9988/yrsg/js/tools.js?_t=1585703091045"></script>
<script type="text/javascript" src="http://xcx.yrtime.cn:9988/yrsg/js/support.js?_t=1585703091045"></script>
<script src="https://cdn.bootcss.com/stomp.js/2.3.3/stomp.min.js"></script>
<script src="https://cdn.bootcss.com/sockjs-client/1.1.4/sockjs.min.js"></script>
<script type="text/javascript" src="http://xcx.yrtime.cn:9988/yrsg/js/yrtime.js?_t=1585703091045"></script>
<script type="text/javascript" src="http://xcx.yrtime.cn:9988/yrsg/js/im.js?_t=1585703091045"></script>
<script type="text/javascript">
    top.domain = 'http://xcx.yrtime.cn:9988/yrsg';
    //im信息配置
    /*var ImRequestUrls = {
        initUrl: 'http://xcx.yrtime.cn:9988/yrsg/web/imUser/query.json',//获取我的信息、好友列表、群组列表
        modifyOnlineStatusUrl: 'http://xcx.yrtime.cn:9988/yrsg/web/imUser/modifyOnlineState.json',//在线状态切换
        modifySign: 'http://xcx.yrtime.cn:9988/yrsg/web/imUser/modifySign.json',//修改签名
        sendMessage: 'http://xcx.yrtime.cn:9988/yrsg/web/imContent/save.json',//发送消息
        findUrl: 'http://xcx.yrtime.cn:9988/yrsg/view/im/group_edit.htm',//发现页面地址
        chatLogUrl: 'http://xcx.yrtime.cn:9988/yrsg/view/im/chat_log.htm',//聊天记录页面地址
        uploadFileUrl:'http://xcx.yrtime.cn:9988/yrsg/web/attachment/imUpload.json'//上传文件地址
    };
    ImSocket.socketUrl = 'wss://xcx.yrtime.cn/im?deviceId=5e888b2d88846db20e8842d2';
    ImSocket.init();
    im.init();*/

    //投屏显示
    var throwingScreen = function() {
        var currentId = $('.page-tabs-content').find('.active').attr('data-id');
        var target = $('#iframe_' + currentId);
        var url = target.attr('src');
        $("#link-span").parent().attr('href', url);
        $("#link-span").click();
    };

    var Application = {
        toStanardMenu: function (menuTree) {
            for (var i = 0; i < menuTree.length; i++) {
                var menu = menuTree[i];
                menu.text = menu.name;
                menu.targetType = "iframe-tab";
                menu.icon = "fa " + menu.icon;
                menu.url = "http://xcx.yrtime.cn:9988/yrsg" + menu.url;
                if (menu.children) {
                    menu.url = "";
                    this.toStanardMenu(menu.children);
                }
            }
        },
        getMenus: function (menuArray) {
            var temp = {}, tree = [];
            for (var i = 0; i < menuArray.length; i++) {
                var menu = menuArray[i];
                temp[menu.id] = menu;
            }
            for (var i = 0; i < menuArray.length; i++) {
                var menu = menuArray[i];
                var parent = temp[menu.parentId];
                if (parent) {
                    if (!parent.children) {
                        parent.children = [];
                    }
                    parent.children.push(menu);
                    continue;
                }
                tree.push(menu);
            }
            this.toStanardMenu(tree);
            $('.sidebar-menu').sidebarMenu({data: tree, param: {strUser: 'admin'}});
        },
        getUser: function () {
            $(".user-header p span").html("杜晓伟");
            $(".user-menu .hidden-xs").html("杜晓伟");

            var menuArray = eval('([{"id":"3481027434960392266","parentId":"5708272939783675127","name":"老人居家","orderBy":200,"icon":"fa-square","state":1,"remark":"","category":1,"code":"elderHome_list","url":"/view/business/elderCater/elderHome_list.htm","parent":null,"categoryStr":"菜单","stateStr":"已启用"},{"id":"5708272939783675127","parentId":null,"name":"客户管理","orderBy":1,"icon":"fa-square","state":1,"remark":"","category":1,"code":"elderManage","url":"","parent":null,"categoryStr":"菜单","stateStr":"已启用"},{"id":"5744613449442782461","parentId":"5708272939783675127","name":"未审核档案","orderBy":20,"icon":"fa-square","state":1,"remark":"","category":1,"code":"elder_valid_list","url":"/view/business/elder/elder_valid_list.htm","parent":null,"categoryStr":"菜单","stateStr":"已启用"},{"id":"5760912601188360053","parentId":"5708272939783675127","name":"老人信息","orderBy":200,"icon":"fa-square","state":1,"remark":"","category":1,"code":"elder_list","url":"/view/business/elder/elder_list.htm","parent":null,"categoryStr":"菜单","stateStr":"已启用"},{"id":"5760912601188360052","parentId":"5708272939783675127","name":"新增老人信息","orderBy":1,"icon":"fa-square","state":1,"remark":"","category":1,"code":"elder_add","url":"/view/business/elder/elder_home.htm","parent":null,"categoryStr":"菜单","stateStr":"已启用"},{"id":"3481027434960392265","parentId":"5708272939783675127","name":"老人配餐","orderBy":200,"icon":"fa-square","state":1,"remark":"","category":1,"code":"elderCater_list","url":"/view/business/elderCater/elderCater_list.htm","parent":null,"categoryStr":"菜单","stateStr":"已启用"}])');
            Application.getMenus(menuArray);
        },
        modifySimplePass: function () {
            layui.layer.open({
                type: 2, shade: 0.3, title: "修改密码",
                closeBtn: 0,
                shadeClose: false,
                area: ['650px', '450px'],
                content: 'http://xcx.yrtime.cn:9988/yrsg/view/user/user_pass.htm?_t=' + new Date().getTime()
            });
        },
        cacheDictionary:function () {
            $.ajax({
                url: 'http://xcx.yrtime.cn:9988/yrsg/web/dictionary/queryAcceptList.json',
                type: 'GET',
                async:false,
                success: function (resp) {
                    if (!resp.success) {
                        alert(data.message);
                        return;
                    }
                    DictionaryHelper.cacheDictionary(resp.data);
                },
                dataType: 'json'
            });
        },
        cacheArea:function () {
            $.ajax({
                url: 'http://xcx.yrtime.cn:9988/yrsg/web/area/queryAcceptList.json',
                type: 'GET',
                async:true,
                success: function (resp) {
                    if (!resp.success) {
                        alert(data.message);
                        return;
                    }
                    AreaHelper.cacheArea(resp.data);
                    App.unblockUI('#main-header');
                },
                dataType: 'json'
            });
        },
        init: function () {
            this.getUser();

            App.blockUI({target: '#main-header', boxed: true, message: '初始化数据中'});
            this.cacheDictionary();
            this.cacheArea();
        }
    };

    $(function () {
        ImSocket.socketUrl = 'ws://117.66.243.192:9988/im?deviceId=5e888b2d88846db20e8842d2';
        //ImSocket.socketUrl = 'ws://127.0.0.1:5678?deviceId=5e888b2d88846db20e8842d2';
        ImSocket.init();
        App.setbasePath("http://xcx.yrtime.cn:9988/yrsg/adminui/");
        $(".login-out").click(function () {
            App.blockUI({target: '#main-header', boxed: true, message: '退出中......'});
            var url = $(this).attr("reurl");
            $.post(url, function (data) {
                if (data.success) {
                    location.href = "http://xcx.yrtime.cn:9988/yrsg/login.htm";
                    return;
                }
                App.unblockUI("#main-header");
                alert(data.message);
            });
        });
        Application.init();
        addTabs(({id: '10008', title: '工作台', close: false, url: 'http://xcx.yrtime.cn:9988/yrsg/view/frame/workbench.htm'}));
        App.fixIframeCotent();
        //$('.sidebar-menu').sidebarMenu({ data: menus, param: { strUser: 'admin' } });

        //定时发送保持心跳的请求,避免登录过期
        setInterval(keepAlive, 1000 * 60 * 10);

        //addTabs(({id: '13170017120', title: '13170017120来电', close: true, url: 'http://xcx.yrtime.cn:9988/yrsg/view/business/elder/elder_screen.htm?phone=13170017120'}));
    });

    //发送保持心跳的请求
    function keepAlive() {
        $.ajax({
            url: 'http://xcx.yrtime.cn:9988/yrsg/web/keepAlive.json',
            type: 'GET',
            success: function (resp) {
                if (!resp.success) {
                    window.location.href = 'http://xcx.yrtime.cn:9988/yrsg/login.htm';
                }
            },
            dataType: 'json'
        });
    }

    /**
     * 初始化呼叫信息
     * @param extID
     */
    var yrTime;
    var initPhoneCall = function(extID) {
        if (!extID) {
            alert("分机号为空，无法初始化呼叫信息");
            return;
        }
        yrTime = new YrTimePhone({serverUrl:"http://117.66.243.192:9988/webSocketServer",extID:extID});
        yrTime.on('onCallComing',function(phoneNo){
            document.getElementById("phoneAudio").play();
            addTabs(({id: phoneNo, title: phoneNo + '来电', close: true, url: 'http://xcx.yrtime.cn:9988/yrsg/view/business/elder/elder_screen.htm?phone=' + phoneNo}));
        });

        yrTime.on('onErrorNotify',function(msg){
            alert(msg.errorMsg);
        });

        yrTime.on('onStatusChange',function(msg){
            console.log('--status--')
            console.log("onStatusChange = " + msg)
        });
    };

    var call = function (phone) {
        if (!yrTime) {
            alert("呼叫中心没有联通");
            return;
        }
        if (!phone) {
            alert("电话号码为空");
            return;
        }
        yrTime.call(phone);
    }
</script>
</body>
</html>